package com.neutech.maplestory.entity;

import com.neutech.maplestory.client.MapleStoryClient;
import com.neutech.maplestory.constant.Constant;
import com.neutech.maplestory.util.ImageUtil;

import java.awt.*;
import java.util.Random;

public class Cloud  extends AbstractMapleStoryObject{
    public static Image[] images = new Image[10];
    static{
        images[0] = ImageUtil.getImage("sky0");
        images[1] = ImageUtil.getImage("sky1");
        images[2] = ImageUtil.getImage("sky2");
        images[3] = ImageUtil.getImage("sky3");
        images[4] = ImageUtil.getImage("sky4");
        images[5] = ImageUtil.getImage("sky5");
    }
    public Cloud(MapleStoryClient msc,int x, int y, int speed) {
        this();
        this.msc = msc;
        this.y = y;
        this.x = x;
        this.speed = speed;
        this.width = images[0].getWidth(null);
        this.height = images[0].getHeight(null);

    }

    public Cloud() {

    }

    @Override
    public void draw(Graphics g) {
        for (int i = 0; i <6 ; i++) {
            g.drawImage(images[i],x,y,null);
        }
        move();
    }
    Random random = new Random();

    @Override
    public void move() {
        this.x -= speed;
        for (int i = 0; i <msc.clouds.size() ; i++) {
            Cloud cloud = msc.clouds.get(i);
            if (cloud.x + cloud.width <=0){
                this.x = Constant.GAME_WINDOW_WIDTH;
            }

        }




    }
}
